<% include ../pageHeader %>
<%

var strPageLinks = String(intEntryCount) + __('entries') + " | " +
        helper.generatePageLinks(intEntryCount, intEntryPerPage, intCurrentPage, 15, strURLPrefix);
%>
<div id="mainWrapper">
    <div id="content" class="content">
        <div id="innerContent">
            <div class="article-top">
                <div class="pages">
                    <% if(input["q"]){ %>
                    <%= __('search') %>: <%= helper.HTMLEncodeLite(input["q"]) %> |
                    <% } %>
                    <%= strPageLinks %>
                </div>
            </div>
            <%
            if(intEntryCount == 0){
            %>
            <div class="no-entry">
                <div class="no-entry-message">
                    <%= __('no_entry') %>
                </div>
            </div>
            <%
            }else{
            for(var i = 0;i < entries.length;i++){
                    with(entries[i]){ %>
            <div class="gbbox">
                <div class="gbbox-content">
                    <div class="gbbox-title">
                        <a href='user.asp?act=view&amp;id=<%= userid %>'><%= username %>
                            <% if(userid == 0)write("*") %>
                        </a>
                        <div class="gbbox-label">
                            [ <%= helper.getDateTimeString("YY-MM-DD hh:ii:ss", postTime) %>
                            <% if(theUser.groupID == 1){ %>
                            | <%= ip %>
                            <% } %>
                            ]
                            <% if(theUser.loggedIn && (theUser.rights["edit"] > 1 ||
                                    (theUser.rights["edit"] == 1 && theUser.id == userid))){ %>
                            &nbsp;<a href="?act=edit&amp;id=<%= id %>"
                                     title="<%= lang['edit']+"/"+__('reply') %>"><img
                                        src="<%= theCache.settings["imageFolder"] %>/icon_edit.gif"
                                        alt="<%= lang['edit']+"/"+__('reply') %>"></a>
                            <% } %>
                            <% if(theUser.loggedIn && (theUser.rights["delete"] > 1 ||
                                    (theUser.rights["delete"] == 1 && theUser.id == userid))){ %>
                            &nbsp;<a href="?act=delete&amp;id=<%= id %>" title="<%= lang['delete'] %>"
                                     onclick="return confirm('<%= __('confirm_delete_comment') %>?')"><img
                                        src="<%= theCache.settings["imageFolder"] %>/icon_del.gif"
                                        alt="<%= lang['delete'] %>"></a>
                            <% } %>
                        </div>
                    </div>
                    <% if(!hidden || (theUser.id == userid && userid != 0) || theUser.rights["view"] > 2){ %>
                        <%
                            var strContent = ubb.toHTML(helper.HTMLEncode(content), ubbFlags, "", true)
                            if (arrKeywords.length > 0) {
                                strContent = helper.highlight(strContent, arrKeywords);
                            }
                        %>
                        <%= strContent %>
                        <% if(editMark){
                            var arrEdit = editMark.split("$|$");
                        %>
                        <div class="editmark">[<%= __('edited_by')+arrEdit[0]+__('at')+arrEdit[1] %>]</div>
                        <% } %>
                    <% }else{ %>
                    <div class="hidden-note"><%= __('hidden_comment') %></div>
                    <% } %>
                </div>
                <% if(reply){ %>
                <div class="gbbox-reply">
                    <div class="gbbox-reply-title">
                        <%= replyUsername %>
                        <div class="gbbox-reply-label">[ <%= helper.getDateTimeString("YY-MM-DD hh:ii:ss", replyTime) %>
                            ]
                        </div>
                    </div>
                    <% if(!hidden || (theUser.id == userid && userid != 0) || theUser.rights["view"] > 2){ %>
                        <%
                            var strContent = ubb.toHTML(helper.HTMLEncode(reply), "110011", "", true)
                            if (arrKeywords.length > 0) {
                                strContent = helper.highlight(strContent, arrKeywords);
                            }
                        %>
                        <%= strContent %>
                    <% }else{ %>
                    <div class="hidden-note"><%= __('hidden_comment') %></div>
                    <% } %>
                </div>
                <% } %>
            </div>
            <% }
            }
            }
            %>
            <div class="article-bottom">
                <div class="pages">
                    <%- strPageLinks %>
                </div>
            </div>
            <br/>
            <%# include('../comment/commentForm', {strTitle: __('post_comment'), strActionURL: '?act=save', strContent: strContent, strUBBFlags: strUBBFlags, bHidden: bHidden, strReply: strReply, bShowReplyArea: bShowReplyArea}) %>
        </div>
    </div>
    <% include ../sidebar %>
    <div class="clear"></div>
</div>
<% include ../pageFooter %>
